package com.dy.cloud.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @ClassName:
 * @Author: 仄言in
 * @Desctiption: (描述)
 * @Date: 2021/9/14 13:14
 * @Version 1.0 (版本)
 */
@RestController
@RequestMapping("/order")
@Slf4j
public class Consul0rderController {
    @Value("${server.port}")
    private String serverPort;
    @Autowired
    private RestTemplate restTemplate;
    private final static String REST_LJ="http://CloudPrividerCOnsulPayment8006/payment";

    /**
     * 消费者入住Cunsul注册中心测试
     * @return
     **/
    @GetMapping("/order")
    public String consulOrder() {
        return restTemplate.getForObject(REST_LJ+"/consul",String.class)+"消费者port:"+serverPort;
    }
}
